/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUIs;

import Core.ConnectionToDatabase;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.*;

/**
 *
 * @author jc156563
 */
public class DisplayInventoryUI extends Frame implements ActionListener{

    protected JFrame frame;

    public void show()
    {

        frame = new JFrame("Inventory");
        JPanel panel = new JPanel();
        JButton back = new JButton("Back");
        ConnectionToDatabase con = new ConnectionToDatabase();
        Vector colNames = new Vector();
        colNames.addElement("Item ID");
        colNames.addElement("Item Name");
        colNames.addElement("Quantity");


        JTable inventoryTable = new JTable(con.getInventoryFull(), colNames);

        frame.setSize(500, 500);
        frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
        JScrollPane scrollPane = new JScrollPane(inventoryTable);
        inventoryTable.setFillsViewportHeight(true);
        frame.add(scrollPane);
        frame.setLocationRelativeTo(null);


        back.addActionListener(this);
        frame.add(panel);
        panel.add(inventoryTable);
        panel.add(back);



        frame.setVisible(true);
    }

    public static void DisplayInventoryUI() {


    }

    public void actionPerformed(ActionEvent e)
    {
        MainUI main = new MainUI();
        main.show();
        frame.setVisible( false );
        frame.dispose();

    }
}
